//
//  CountryCollectionViewCell.m
//  PTravel
//
//  Created by dllo on 15/11/16.
//  Copyright © 2015年 李涵. All rights reserved.
//

#import "HotCountryCollectionViewCell.h"

@implementation HotCountryCollectionViewCell

- (void)dealloc
{
    [_image release];
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews
{
    self.image = [[UIImageView alloc] initWithFrame:self.contentView.bounds];
    self.image.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:self.image];
    [_image release];
    
    self.cnname = [[UILabel alloc] initWithFrame:CGRectMake(0, self.contentView.frame.size.height-40, 70, 20)];
    self.cnname.textColor = [UIColor whiteColor];
    self.cnname.font = [UIFont systemFontOfSize:15];
    [self.image addSubview:self.cnname];
    [_cnname release];
    
    self.enname = [[UILabel alloc] initWithFrame:CGRectMake(0, self.contentView.frame.size.height-20, 70, 20)];
    self.enname.font = [UIFont systemFontOfSize:15];
    self.enname.textColor = [UIColor whiteColor];
    [self.image addSubview:self.enname];
    [_enname release];
    
}


- (void)setHotCountry:(Country *)hotCountry
{
    if (_hotCountry != hotCountry) {
        [_hotCountry release];
        _hotCountry = [hotCountry retain];
    }
    self.cnname.text = hotCountry.cnname;
    self.enname.text = hotCountry.enname;
    NSURL *url = [NSURL URLWithString:hotCountry.photo];
    [self.image sd_setImageWithURL:url placeholderImage:IMAGE];
    
}


@end
